#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

char buf[(int) 1e7], *fs = buf;

inline int gn() { 
    int k = 0;
    char c = *fs++;
    for (; !isdigit(c); c = *fs++);
    for (; isdigit(c); c = *fs++) k = k * 10 + c - '0';
    return k;
}

bool vis[100003];
int sum, a[100003], k, n, ans;
vector<int> aa;

void dfs(int now, int pre) { 
    if (n - pre < k - now + 1) return;
    if (now == k + 1) { 
        ans += sum;
        return;
    }
    for (int i = pre + 1; i <= n; i++) { 
        sum ^= a[i];
        dfs(now + 1, i);
        sum ^= a[i];
    }
}

int main() { 
    freopen("card.in", "r", stdin);
    freopen("card.out", "w", stdout);
    fread(buf, 1, (int) 1e7, stdin);
    n = gn(), k = gn();
    for (int i = 1; i <= n; i++)
        a[i] = gn();
    dfs(1, 0);
    cout << ans << '\n';
}
